﻿using Might.Infrastructure.Annotations.Graphics;
using Might.Infrastructure.ModelicaDOM;

namespace Might.Modelica.Annotations.Graphics {
    ///<summary>
    ///</summary>
    [Mapping("Rectangle")]
    public class GraphicsRectangle : GraphicsFilledShapeEx, IGraphicsRectangle {
        ///<summary>
        ///</summary>
        public GraphicsRectangle() {
            borderPattern = BorderPattern.None;
            radius = 0;
        }

        #region IGraphicsRectangle Members

        [Mapping("radius")]
        public double CornerRadius {
            get { return radius; }
            set {
                if (radius != value) {
                    radius = value;
                    OnChanged(this, "Radius");
                }
            }
        }
        private double radius;

        #endregion

        #region Specific Modelica members

        // TODO not supported yet
        ///<summary>
        ///</summary>
        [Mapping("borderPattern")]
        public BorderPattern borderPattern { get; set; }

        public override bool IsDefault {
            get {
                return base.IsDefault &&
                    borderPattern == BorderPattern.None &&
                    radius == 0;
            }
        }

        #endregion
    }
}